package com.uni.controller;

import com.alibaba.fastjson.JSON;
import com.uni.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Author:      Unirithe/Mr.Chao
 * CSDN:        https://blog.csdn.net/Unirithe
 * CreatedTime:  2022/2/4 14:22
 **/
@RestController
public class AddressController {

    @Autowired
    private AddressService addressService;
    @GetMapping("/getProvinces")
    public String getProvinces(){
        return JSON.toJSONString(addressService.getAllProvinces());
    }
    @GetMapping("/getCities")
    public String getCities(String provCode){
        return JSON.toJSONString(addressService.getCitiesByProvCode(provCode));
    }
    @GetMapping("/getAreas")
    public String getAreas(String cityCode){
        return JSON.toJSONString(addressService.getAreasByCityCode(cityCode));
    }

}
